package com.example.LightningController;

import android.os.Parcel;
import android.os.Parcelable;

public class Zone implements Item, Parcelable {
    public enum ButtonState{
        ON(1), OFF(0);

        private int state;

        private ButtonState(int state){
            this.state = state;
        }
    }

	private String tag;
	private int ID;
	private String mode;
	private String masterSwitchDependency;
	private String highLowState;
	private String temperature;
	private String lowTempTemperatureLevel;
	private String highTempTemperatureLevel;
	private String thermostatCurrentValue;
    private ButtonState state;
    private String macAddress;

	public Zone() {
	}

	public Zone(Parcel source) {
        this.tag = source.readString();
        this.ID = source.readInt();
        this.mode = source.readString();
        this.masterSwitchDependency = source.readString();
        this.highLowState = source.readString();
        this.temperature = source.readString();
        this.lowTempTemperatureLevel = source.readString();
        this.highTempTemperatureLevel = source.readString();
        this.macAddress = source.readString();
    }

	public Zone(int ID, String tag, String macAddress) {
		this.tag = tag;
		this.ID = ID;
		this.mode = mode;
		this.masterSwitchDependency = masterSwitchDependency;
		this.highLowState = highLowState;
		this.temperature = temperature;
		this.lowTempTemperatureLevel = lowTempTemperatureLevel;
		this.highTempTemperatureLevel = highTempTemperatureLevel;
        this.state = state;
        this.macAddress = macAddress;
	}

	public String getTag() {
		return this.tag;
	}

	@Override
	public int getID() {
		return this.ID;
	}
	
	public String getMode(){
		return this.mode;
	}
	
	public void setMasterSwitchDependency(String value) {
		this.masterSwitchDependency = value;
	}
	
	public String getMasterSwitchDependency(){
		return this.masterSwitchDependency;
	}
	
	public void setHighLowState(String state) {
		this.highLowState = state;
	}
	
	public void setThermostatCurrentValue(String value){
		this.thermostatCurrentValue = value;
	}
	
	public void setZoneMode(int integerValue) {
		switch(integerValue){
		case 1:
			this.mode = "01";
			break;
		case 2:
			this.mode = "10";
			break;
		case 3:
			this.mode = "11";
			break;
		}
	}
	
	public String getHighLowState(){
		return this.highLowState;
	}
	
	public String getTemperature(){
		return this.temperature;
	}
	
	public void setLowTempTemperatureLevel(String level){
		this.lowTempTemperatureLevel = level;
	}
	
	public String getLowTempTemperatureLevel(){
		return this.lowTempTemperatureLevel;
	}
	
	public void setHighTempTemperatureLevel(String level){
		this.highTempTemperatureLevel = level;
	}
	
	public String getHighTempTemperatureLevel(){
		return this.highTempTemperatureLevel;
	}

    public void setState(ButtonState state){
        this.state = state;
    }

    public ButtonState getState(){
        return this.state;
    }

    public void setMacAddress(String macAddress){
        this.macAddress = macAddress;
    }

    public String getMacAddress(){
        return this.macAddress;
    }

	@Override
	public boolean isSection() {
		return false;
	}

	public static final Creator CREATOR = new Creator() {
		public Zone createFromParcel(Parcel source) {
			return new Zone(source);
		}

		public Zone[] newArray(int size) {
			return new Zone[size];
		}
	};

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(this.tag);
		dest.writeInt(this.ID);
		dest.writeString(this.mode);
		dest.writeString(this.masterSwitchDependency);
		dest.writeString(this.highLowState);
		dest.writeString(this.temperature);
		dest.writeString(this.lowTempTemperatureLevel);
		dest.writeString(this.highTempTemperatureLevel);
        dest.writeString(this.macAddress);
	}
}
